package com.changgou.goods;

import java.util.stream.Stream;

/**
 * @author Duan SanMao
 * @date 2021/9/26
 */


public enum DelFlagEnum {

    /**
     * 已删除
     */
    Y(1,"已删除"),
    /**
     * 未删除
     */
    N(0,"未删除");



    private final Integer code;
    private final String description;

    DelFlagEnum(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public static DelFlagEnum getDescription(Integer code)  {
        return Stream.of(values()).filter(e->e.getCode().equals(code)).findFirst().orElseThrow(()->new RuntimeException("删除状态不存在"));


    }

    public Integer getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }
}
